function [r,rBuy,rSell,parameters] = testTimeSeries2(price_path,model)
r = log(price_path(2:end)./price_path(1:end-1));

forecastValue = NaN(length(price_path)-1,1);
rBuy = NaN(length(price_path),1);
rSell = NaN(length(price_path),1);
    
if strcmp(model,'AR1')
    model = arima(1,0,0); %model AR(1)
elseif strcmp(model,'AR1-GARCH')
    model = arima('ARLags',1,'Variance',garch(1,1)); %model AR(1)-GARCH(1,1)
elseif strcmp(model,'AR1-EGARCH')
    model = arima('ARLags',1,'Variance',egarch(1,1)); %model AR(1)-EGARCH
end
[fit,VarCov,~,info] = estimate(model,r);

for i=2:length(price_path)
    [forecastValue(i-1) ~] = forecast(fit,1,'Y0',r(i-1));
if(forecastValue(i-1)>=0)
        rBuy(i-1) = log(price_path(i)/price_path(i-1));
end 
if(forecastValue(i-1)<0)
        rSell(i-1) = log(price_path(i)/price_path(i-1));
end
end
parameters = info.X;

%standard_error = sqrt(diag(VarCov));
%t_statistic = info.X./standard_error;

% close all
hold on
plot(forecastValue,'blue');
plot(r,'red');
